package cn.hx.whh.automaticticket.params;


import com.alibaba.fastjson.JSONObject;

import cn.hx.whh.automaticticket.constant.Constants;
import cn.hx.whh.automaticticket.entity.Employee;
import cn.hx.whh.automaticticket.utils.MapUtils;

/**
 * 验票请求参数
 */
public class CheckTicketReport implements RequestParams {
    public String checkBak;
    public Integer checkType = 1;
    public String deviceId = Constants.getSerialNumber();
    public String deviceType = String.valueOf(Constants.Device_Type);
    public String operatorName = Employee.getInstance().getName();
    public String operatorNo = Employee.getInstance().getAccount();
    public String ticketNo;
    public String qrCodeVal;

    public CheckTicketReport(String checkBak, int checkType, String ticketNo, String qrCodeVal) {
        this.checkBak = checkBak;
        this.checkType = checkType;
        this.ticketNo = ticketNo;
        this.qrCodeVal = qrCodeVal;
    }

    @Override
    public String toJSONString() {
        return "{" +
                "\"checkBak\":\"" + checkBak + "\"" +
                ", \"checkType\":\"" + checkType + "\"" +
                ", \"deviceId\":\"" + deviceId + "\"" +
                ", \"deviceType\":" + deviceType +
                ", \"operatorName\":\"" + operatorName + "\"" +
                ", \"operatorNo\":\"" + operatorNo + "\"" +
                ", \"ticketNo\":\"" + ticketNo + "\"" +
                ", \"qrCodeVal\":\"" + qrCodeVal + "\"" +
                "}";
    }

    @Override
    public MapUtils toMapUtils() {
        MapUtils map = MapUtils.getHttpInstance();
        map.put("checkBak", this.checkBak == null ? "" : this.checkBak);
        map.put("checkType", this.checkType);
        map.put("deviceId", this.deviceId);

        map.put("deviceType", this.deviceType);
        map.put("operatorName", this.operatorName);
        map.put("operatorNo", this.operatorNo);

        map.put("ticketNo", this.ticketNo == null ? "" : this.ticketNo);
        map.put("qrCodeVal", this.qrCodeVal == null ? "" : this.qrCodeVal);
        return map;
    }

    @Override
    public JSONObject toJSONObject() {
        return JSONObject.parseObject(toJSONString());
    }

    @Override
    public String toString() {
        return "CheckTicketReport{" +
                "checkBak='" + checkBak + '\'' +
                ", checkType='" + checkType + '\'' +
                ", deviceId='" + deviceId + '\'' +
                ", deviceType=" + deviceType +
                ", operatorName='" + operatorName + '\'' +
                ", operatorNo='" + operatorNo + '\'' +
                ", ticketNo='" + ticketNo + '\'' +
                ", qrCodeVal='" + qrCodeVal + '\'' +
                '}';
    }

    public String getCheckBak() {
        return checkBak;
    }

    public void setCheckBak(String checkBak) {
        this.checkBak = checkBak;
    }

    public int getCheckType() {
        return checkType;
    }

    public void setCheckType(int checkType) {
        this.checkType = checkType;
    }

    public String getDeviceId() {
        return deviceId;
    }

    public void setDeviceId(String deviceId) {
        this.deviceId = deviceId;
    }

    public String getDeviceType() {
        return deviceType;
    }

    public void setDeviceType(String deviceType) {
        this.deviceType = deviceType;
    }

    public String getOperatorName() {
        return operatorName;
    }

    public void setOperatorName(String operatorName) {
        this.operatorName = operatorName;
    }

    public String getOperatorNo() {
        return operatorNo;
    }

    public void setOperatorNo(String operatorNo) {
        this.operatorNo = operatorNo;
    }

    public String getTicketNo() {
        return ticketNo;
    }

    public void setTicketNo(String ticketNo) {
        this.ticketNo = ticketNo;
    }

    public String getQrCodeVal() {
        return qrCodeVal;
    }

    public void setQrCodeVal(String qrCodeVal) {
        this.qrCodeVal = qrCodeVal;
    }
}
